const { Sequelize } = require('sequelize')

const {
  dbName,
  host,
  port,
  user,
  password
} = require('../config/config').database;

const sequelize = new Sequelize(dbName, user, password, {
  host,
  port,
  dialect: 'mysql',
  logging: true,
  timezone: '+08:00',
  define: {
    timestamps: true,
    paranoid: true,
    /* createdAt: 'create_at',
    updatedAt: 'update_at',
    deletedAt: 'delete_at', */
    underscored: true,
  }
});
sequelize.sync({
  force: true
});

module.exports = {
  sequelize
};